package com.stylefeng.guns.modular.system.api;

import com.stylefeng.guns.core.response.JsonResult;
import com.stylefeng.guns.core.response.ResultGenerator;
import com.stylefeng.guns.modular.system.model.WakeUp;
import com.stylefeng.guns.modular.system.service.IWakeUpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping
public class WakeUpApiController {

    @Autowired
    IWakeUpService iWakeUpService;


    @RequestMapping(value = "/getDeepLink/{cpid}")
    public JsonResult getJarVersion( @PathVariable String cpid){

        WakeUp wakeUp = null;
        try {

            wakeUp = iWakeUpService.getWakeupByCpid(cpid);

            if(wakeUp == null){
               return  ResultGenerator.genFailResult("return null");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return ResultGenerator.genFailResult("error");
        }

        return ResultGenerator.genSuccessResult(wakeUp);
    }
}
